package com.topdt.jbpm.model;

import java.sql.Timestamp;
import java.text.ParseException;
import java.util.Date;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;

import com.thx.common.util.DateUtil;
import com.topdt.jbpm.form.Document;
@Entity
@Table(name = "bus_apply_car")
public class ApplyCar extends JbpmModel implements Document{

	@Id
	@GeneratedValue(generator = "generator")
	@GenericGenerator(name = "generator", strategy = "uuid")
	@Column(length = 50)
	private String id;
	
	@Column(name = "apply_car_user")
	private String fp_applyCarUser;
	@Transient
	private String fp_applyCarUser_name = "申请用车人员";
	
	@Column(name = "apply_car_type")
	private String fp_applyCarType;
	@Transient
	private String fp_applyCarType_name = "用车类型";
	
	@Column(name = "start_date")
	private Timestamp fp_startDate;
	@Transient
	private String fp_startDate_name = "开始时间";
	
	@Column(name = "end_date")
	private Timestamp fp_endDate;
	@Transient
	private String fp_endData_name = "结束时间";
	
	@Column(name = "is_return_car")
	private String fp_isReturnCar;
	@Transient
	private String fp_isReturnCar_name = "是否还车";
	
	@Column(name = "apply_car_day")
	private int fp_applyCarDay;
	@Transient
	private String fp_applyCarDay_name = "用车天数";
	
	private String destination;
	private String reason;
	private String driver;
	private Timestamp returnCarDate;
	
	private String workId;
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getApplyCarUser() {
		return fp_applyCarUser == null ? "" : fp_applyCarUser;
	}
	public void setApplyCarUser(String fp_applyCarUser) {
		this.fp_applyCarUser = fp_applyCarUser;
	}
	public String getApplyCarType() {
		return fp_applyCarType == null ? "" : fp_applyCarType;
	}
	public void setApplyCarType(String fp_applyCarType) {
		this.fp_applyCarType = fp_applyCarType;
	}
	public String getDestination() {
		return destination == null ? "" : destination;
	}
	public void setDestination(String destination) {
		this.destination = destination;
	}
	
	public String getDriver() {
		return driver == null ? "" : driver;
	}
	public void setDriver(String driver) {
		this.driver = driver;
	}
	public String getIsReturnCar() {
		return fp_isReturnCar == null ? "" : fp_isReturnCar;
	}
	public void setIsReturnCar(String fp_isReturnCar) {
		this.fp_isReturnCar = fp_isReturnCar;
	}
	public String getWorkId() {
		return workId;
	}
	public void setWorkId(String workId) {
		this.workId = workId;
	}
	public String getStartDate() {
		return fp_startDate == null ? "" : DateUtil.format(fp_startDate, "yyyy-MM-dd HH:mm:ss");
	}
	public void setStartDate(String fp_startDate) throws ParseException {
		this.fp_startDate = fp_startDate== null || fp_startDate.length() <= 0
				? null :new Timestamp(DateUtil.parse(fp_startDate, "yyyy-MM-dd HH:mm:ss").getTime());
		
	}
	
	public String getEndDate() {
		return fp_endDate == null ? "" :  DateUtil.format(fp_endDate, "yyyy-MM-dd HH:mm:ss");
	}
	public void setEndDate(String fp_endDate) throws ParseException {
		this.fp_endDate = fp_endDate == null || fp_endDate.length() <= 0 
				? null : new Timestamp(DateUtil.parse(
						fp_endDate, "yyyy-MM-dd HH:mm:ss").getTime()) ;
	}
	public String getReturnCarDate() {
		return returnCarDate == null ? "" :  DateUtil.format(returnCarDate, "yyyy-MM-dd HH:mm:ss");
	}
	public void setReturnCarDate(String returnCarDate) throws ParseException {
		this.returnCarDate = returnCarDate == null || returnCarDate.length() <= 0 
				? null : new Timestamp(DateUtil.parse(returnCarDate,
						"yyyy-MM-dd HH:mm:ss").getTime());
	}
	public String getReason() {
		return reason == null ? "" : reason;
	}
	public void setReason(String reason) {
		this.reason = reason;
	}
	
	
	
	public int getApplyCarDay() {
		return fp_applyCarDay;
	}
	public void setApplyCarDay(int fp_applyCarDay) {
		this.fp_applyCarDay = fp_applyCarDay;
	}
	@Override
	public String getDocId() {
		return this.workId;
	}
	@Override
	public void setDocId(String docId) {
		this.workId = docId;
	}
	@Override
	public Map<String, Object> getDataMap() {
		// TODO Auto-generated method stub
		return null;
	}

	
}
